<template>
	 <view>
	     <view class="fui-header fui-header-success">
			
	     	<navigator  class="fui-header-left iconfont icon-fanhui"  @tap="result">
	     	  
	     	</navigator>
	     	<view class="title">结算记录</view>
	     	<view class="fui-header-right">
	     		<navigator url="./manage">申请结算</navigator>
	     	</view>
	     </view>
	     <view class="status_bar"></view>
	     <v-tabs
	       :value="status"
	       :scroll="false"
	       :tabs="nav"
	       :bold="false"
	        v-on:change="change"  
	     ></v-tabs>
		<!-- 无数据 -->
		
		<view class="fui-content" v-if="list.length<1">
			 <view class="content-empty" style="display: block;">
				 <view class="iconfont icon-wushuju1"></view>暂时没有任何数据
			 </view>
		 </view>
		 
		 <view class="fui-list-group" id="container" style="display: block;" v-for="(key, index) in list" :key="index">
			 <navigator href="#" class="fui-list">
				 <view class="fui-list-inner">
					 <view class="row">
						 <view class="row-text">编号: {{list[index].applyno}}</view>
					 </view>
					 <view class="subtitle">
						 <text>申请金额: {{list[index].realpricerate}}</text>
						 <text>实际金额:{{list[index].realprice}}</text><br/>					
						 <text>无效时间:{{list[index].invalidtime}}</text>					 
					 </view>
				 </view>				 
			 </navigator>
		</view>
		<view class="bstatus_bar"></view>
		<footernav></footernav>
	  </view>
</template>

<script>
	var t = getApp().globalData,
		e = t.requirejs('core'),
		i = t.requirejs('foxui'),
		a = t.requirejs('jquery');
	export default {
		data() {
			return {
				list:[],
				nav:['待审核', '待结算', '已结算', '无效'],
				navKey:[
					1,
					2,
					3,
					-1
				],
				status:0,
				page:1,
				//下拉数据没有数据，暂停下拉操作
				stop:true
			}
		},
		onShow(){
			this.list=[]
			this.page=1
			this.init()	
		},
		
		//下拉加载
		onReachBottom(){
			if(this.stop==false){
				return false
			}
			this.page+=1
			this.init()
		},
		methods: {
			//返回上一页
			result(){
				let pages = getCurrentPages();
				if(pages.length<2){
					uni.navigateTo({
					    url: '../merchmanage/merchmanage'
					});
				}else{
					uni.navigateBack({
						 delta: 1
					});	
				}
			},
			//菜单选择
			change(index){
				this.list=[]
				this.status=index
				this.stop=true
				this.page=1
				this.init()
			},
			//页面获取数据
			init(){
				let self=this
				let data={}
				data.status=this.navKey[this.status]
				data.page=this.page
				//结算记录
				e.get('merchmanage.apply.get_list', data, function(t) {
					if(t.result.list.length<1){
						if(data.page==1)
							self.stop=true
						else
							self.stop=false
						return	
					}
					if(type=='add'){
						self.list=self.list.concat(t.result.list);
						
					}else{
						self.list=t.result.list
					}
				});
				
			}
		}
	}
</script>

<style>
.fui-header-right navigator{
	font-size: 24rpx;
}
.content-empty {
    position: relative;
    text-align: center;
    margin-top: 20vh;
    color: #ccc;

}

.content-empty .iconfont {
    font-size: 250rpx;
	height: 250rpx;
	line-height: 250rpx;
	padding-bottom: 30rpx;
}
.fui-list-inner .subtitle{
	margin-top: 10rpx;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}
.subtitle text{
	padding-right: 20rpx;
}

</style>
